﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SmartCity.ProcessEngine.Api.Read.Application.Command.FormNodeConfig;
using SmartCity.ProcessEngine.Api.Read.Dtos;
using SmartCity.ProcessEngine.ErrorCode;

namespace SmartCity.ProcessEngine.Api.Read.Controllers
{

    /// <summary>
    /// 表单节点配置控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class NodeCfgController : ControllerBase
    {
        private readonly IMediator mediator;

        public NodeCfgController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 分页查询表单节点配置列表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public  Task<ApiPaging<NodeCfgDto>> GetNodeCfgs([FromQuery]GetNodeCfgCommand request) { 
        return  mediator.Send(request);
        }
    }
}
